﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace D2
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] num=new int[100];
            Random ran = new Random();
            for (int i = 0; i < 100; i++)
            {
                num[i]= ran.Next(0, 1000);
            }
            var nums = from item in num
                       orderby item descending
                       select item;
            int sum = 0;
            double avg = 0;
            foreach (var it in nums) {
                sum += it;
                Console.WriteLine(it);
            }
            avg = sum / 100.0;
            Console.WriteLine("sum="+sum);
            Console.WriteLine("avg="+ avg);
            Console.ReadLine();
        }
    }
}
